package com.yfp.operation.controller;

import com.alibaba.fastjson2.JSONObject;
import com.yfp.common.core.domain.R;
import com.yfp.operation.domain.WithdrawRule;
import com.yfp.operation.service.WithdrawRuleService;
import io.swagger.annotations.ApiParam;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @Description: 提现规则
 *
 * @CreateDate: 2024/6/24 11:22
 * @UpdateUser:
 * @UpdateDate: 2024/6/24 11:22
 * @UpdateRemark: 暂无修改
 * @Version: 1.0
 */
@RestController
@RequestMapping("/accountfde")
@Tag(name = "提现规则")
@Slf4j
public class WithdrawRuleController {
    @Autowired
    private WithdrawRuleService withdrawRuleService;

    @Operation(summary = "查询提现规则", description = "查询提现规则")
    @GetMapping("/find")
    public R<WithdrawRule> find() {
        WithdrawRule withdrawRule = withdrawRuleService.findById(1L);
        return R.ok(withdrawRule);
    }

    @Operation(summary = "保存提现规则", description = "保存提现规则")
    @PostMapping("/save")
    public R<Void> save(@RequestBody WithdrawRule withdrawRule) {
        log.info("WithdrawRule: {}", JSONObject.toJSONString(withdrawRule));
        withdrawRuleService.save(withdrawRule);
        return R.ok();
    }
}
